using System;
using System.Collections.Generic;
using System.Linq;

namespace DIS_WEB_Client.Repositories
{
	#region using
	using DIS_WEB_Client.Models;
	using DIS_WEB_Client.Helpers;
    using DIS_WEB_Client.DIS_BUS_WS;
	#endregion
	public class CategoryRepository
	{
		public List<CategoryDTO> SelectAll()
		{
			try
			{
				return BusService.Instance.Category_SelectAll().ToList();
			}
			catch(Exception ex)
			{
				if (ex.InnerException != null)
				{
					GlobalVariables.Logger.Error(ex.InnerException.Message);
				}
				else
				{
					GlobalVariables.Logger.Error(ex.Message);
				}
			}
			return new List<CategoryDTO>();
		}

        public CategoryDTO SelectByID(int id)
        {
            try
            {
                return BusService.Instance.Category_SelectByID(id);
            }
            catch (Exception ex)
            {
                if (ex.InnerException != null)
                {
                    GlobalVariables.Logger.Error(ex.InnerException.Message);
                }
                else
                {
                    GlobalVariables.Logger.Error(ex.Message);
                }
            }
            return null;
        }
	}
}